<!--
  @author heguanghua
  @since 2020/05/07 09:32
-->
<!DOCTYPE html SYSTEM "http://www.thymeleaf.org/dtd/xhtml1-strict-thymeleaf-4.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head th:include="common/common::jscss"/>
<style>
    .tmpPwd {
        display: none;
        width: 520px;
        height: 180px;
        overflow-x: hidden;
    }

    .quote {
        width: 100%;
        border-left: none;
        font-size: 10px;
        height: 40px;
        padding: 6px 25px !important;
    }

    .layui-elem-quote {
        margin-bottom: 10px;
        line-height: 22px;
        border-left: 7px solid #009688;
        border-radius: 0 2px 2px 0;
        background-color: #f2f2f2;
    }

    .layui-elem-quote {
        padding: 6px 25px !important;
    }

    .perWidth {
        width: 33.33% !important;
    }
</style>
<body>

<div class="layui-fluid"
     th:with="hasDetail=${#authPermit.checkPermit('/staff/detail.action')},
     hasList=${#authPermit.checkPermit('/staff/list.action')},
     hasSyncData=${#authPermit.checkPermit('/staff/syncData.action')},
     hasAddEdit=${#authPermit.checkPermit('/staff/modify/addEdit.action')},
     hasModifyStatus=${#authPermit.checkPermit('/staff/modify/modifyStatus.action')},
     hasModifySort=${#authPermit.checkPermit('/staff/modify/modifySort.action')},
     hasResetPwd=${#authPermit.checkPermit('/staff/modify/resetPwd.action')},
     hasExport=${#authPermit.checkPermit('/staff/modify/export.action')},
     hasImportPerformance=${#authPermit.checkPermit('/staff/toimportperformanceexcel.action')}">

    <blockquote class="layui-crumb">
        <a th:lay-href="|${SYS_MCC}/staff/list.action|">员工管理</a>
    </blockquote>

    <div class="layui-card">

        <form method="POST" class="layui-form" action="/staff/list.action">
            <div th:replace="staff/_query::query"></div>
        </form>

        <div class="layui-card-body">

            <div th:replace="staff/_table::table"></div>

            <script type="text/html" id="zmn-table-tool">
                <div class="layui-btn-container">
                    <div class="layui-btn-group" th:if="${hasModifyStatus}">
                        <button class="layui-btn layui-btn-sm" lay-event="start">启用</button>
                        <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="stop">停用</button>
                    </div>
                    <div class="layui-btn-group">
                        <button class="layui-btn layui-btn-sm layui-btn-danger" lay-event="resetPwd" th:if="${hasResetPwd}">重置密码</button>
                    </div>
                    <div class="layui-btn-group">
                        <a th:lay-href="|${SYS_MCC}/staff/detail.action|" class="layui-btn layui-btn-sm layui-btn-primary" lay-text="添加员工" text="添加员工" th:if="${hasAddEdit}">+添加员工</a>
                    </div>
                    <div class="layui-btn-group" th:if="${hasSyncData}">
                        <button class="layui-btn layui-btn-sm layui-btn-primary"
                                th:onclick="|syncBeisengData()|"
                                id="syncBeisengData">同步人事系统
                        </button>
                    </div>
                    <div class="layui-btn-group" th:if="${#authPermit.checkPermit('/staff/modify/batch/opendate.action')}">
                        <button class="layui-btn layui-btn-sm layui-btn-primary" lay-event="batchLimitIp">批量不限IP</button>
                    </div>
                </div>
            </script>

        </div>

    </div>

</div>

<div class="tmpPwd" id="tmpPwd">
    <div class="layui-elem-quote quote">
        <p style="font-size: 12px">1、设置临时密码后，将生成账号登录地址；</p>
        <p style="font-size: 12px">2、临时密码及账号登录地址有效期为1小时。</p>
    </div>
    <div class="layui-form-item" id="pwdSet">
        <label class="layui-form-label"> 临时密码：</label>
        <div class="layui-input-block">
            <div class="layui-input-inline" style="width: 390px">
                <input type="password" name="pwd" id="pwd" lay-verify="required" autocomplete="off" class="layui-input" maxlength="100"/>
            </div>
        </div>
    </div>
    <div class="layui-form-item" id="pwdLogin" style="display: none;margin-left: 50px">
        <label class="layui-form-label" style="width:130px"> 账号登录地址：</label>
        <input id="location" type="hidden">
        <button class="layui-btn" onclick="gotoUrl()">前往登录</button>
    </div>
</div>

<div class="tmpPwd" id="batchOpenDate">
    <div class="layui-elem-quote quote">
        <p style="font-size: 12px">1、有效期范围内，登录时忽略IP认证的限制；</p>
        <p style="font-size: 12px">2、有效期结束后，忽略IP认证自动失效，登录时将校验IP是否认证，未认证则无法登录</p>
    </div>

    <div class="layui-form-item layui-margin-t" id="limitDate">
        <label class="layui-form-label" style="width:80px;">有效期：</label>
        <div class="layui-input-inline" style="width:320px;">
            <input type="text" id="dateRange" name="dateRange"
                   placeholder="yyyy/MM/dd HH:mm:ss - yyyy/MM/dd HH:mm:ss" autocomplete="off" class="layui-input"/>
        </div>
    </div>
    <div class="layui-form-item submit">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="zmn-ip-form-submit">保存</button>
            <button type="reset" lay-submit="" lay-filter="zmn-ip-form-reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</div>
</body>
</html>

<script type="text/javascript" th:inline="javascript">
    const json = {
        plat: [[${vo.plat}]],
        orgTwoId: [[${vo.orgTwoId}]],
        orgId: [[${vo.orgId}]],
        deptOneId: [[${vo.deptOneId}]],
        deptTwoId: [[${vo.deptTwoId}]],
        deptId: [[${vo.deptId}]],
        status: [[${vo.status}]],
        totalCount: [[${vo.totalCount}]],
        pageSize: [[${vo.pageSize}]],
        pageIndex: [[${vo.pageIndex}]],
        vo: [[${vo}]],
        hasDetail: [[${#authPermit.checkPermit('/staff/detail.action')}]],
        hasExport: [[${#authPermit.checkPermit('/staff/modify/export.action')}]],
        hasBindMaster: [[${#authPermit.checkPermit('/engineer/openBindingEngineerWindow.action')}]],
        hasTempPwd: [[${#authPermit.checkPermit('/staff/modify/setTempPwd.action')}]],
        hasIpTime: [[${#authPermit.checkPermit('/staff/detail/opendate.action.action')}]],
        hasWhitelist: [[${#authPermit.checkPermit('/staff/detail/whitelist.action.action')}]],
        hasSynchroDingTalk: [[${#authPermit.checkPermit('/staff/dingtalk/synchro.action')}]],
        hasSynchroBeisen: [[${#authPermit.checkPermit('/staff/beisen/synchro.action')}]],
        hasLeave: [[${#authPermit.checkPermit('/staff/staffleaveoffice/leave.action')}]],
        hasReinstatement: [[${#authPermit.checkPermit('/staff/staffreinstatement/addEditView.action')}]],
        hasStaffChange: [[${#authPermit.checkPermit('/staff/staffchangelog/list.action')}]],
        hasPermitRole: [[${#authPermit.checkPermit('/staff/role/list.action')}]],
        hasPermitData: [[${#authPermit.checkPermit('/staff/dpermit/organize/tree.action')}]],
        hasEditSubarea: [[${#authPermit.checkPermit('/staff/subarea/addEdit.action')}]],

    };
    layui.config({
        version: 2021031211035,
        base: "/static/lay/"
    }).extend({
        staff_list: "staff/zmn.staff.list"
    }).use(['index', 'staff_list']);

    function gotoUrl() {
        var location = $("#location").val();
        console.log(location);
        window.location.href = location;
    }


</script>
